#include <iostream>
#include <vector>
using namespace std;

int main() {
    string t;
    cin >> t;
    bool flag = true;
    vector<char> s;
    for (int i = 0; i < t.size(); i++) {
        if (t[i] == '(' or t[i] == '[' or t[i] == '{' or t[i] == '<') {
            s.push_back(t[i]);
        }
        else if (t[i] == ')' or t[i] == ']' or t[i] == '}' or t[i] == '>') {
            if (s.empty()) {
                flag = false;
                break;
            }
            else if (t[i] - s.back() == 1 or t[i] - s.back() == 2) {
                s.pop_back();
            }
            else {
                flag = false;
                break;
            }
        }
    }

    if (flag and s.empty()) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}